home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / Apps / ScreenSavers / BackSpaceViews / SchoolView.BackModule / SchoolView.h < prev    next >
Text File  |  1995-06-12  |  2KB  |  87 lines

  1. /**********************************************************************
  2.   SchoolView.h
  3.  
  4.   Author:    David C. "Slam" Lambert
  5.   Date:        1 February, 1993
  6. **********************************************************************/
  7. #import <appkit/View.h>
  8.  
  9. struct boid    {
  10.     float    x;
  11.     float    y;
  12.     float    xVel;
  13.     float    yVel;
  14.     float    xAcc;
  15.     float    yAcc;
  16. };
  17.  
  18. typedef struct boid    BOID;
  19.  
  20. #define BOID_X(b)        ((b)->x)
  21. #define BOID_Y(b)        ((b)->y)
  22. #define BOID_XVEL(b)    ((b)->xVel)
  23. #define BOID_YVEL(b)    ((b)->yVel)
  24. #define BOID_XACC(b)    ((b)->xAcc)
  25. #define BOID_YACC(b)    ((b)->yAcc)
  26.  
  27. #define ABS(x)            ((x>0.0)?x:-x)
  28. #define XDIFF(b0, b1)    ((b0->x) - (b1->x))
  29. #define YDIFF(b0, b1)    ((b0->y) - (b1->y))
  30. #define NORM(q1, q2)    (sqrt(q1*q1 + q2*q2))
  31. #define MIN_DIST        (0.5)
  32.  
  33. @interface SchoolView:View
  34. {
  35.     int        schoolCount;
  36.     int        goalChgFreq;
  37.     BOOL    hasColor;
  38.     BOOL    followMouse;
  39.     float    maxVel;
  40.     float    minVel;
  41.     float    distExp;
  42.     float    accLimit;
  43.     float    avoidFact;
  44.     float    matchFact;
  45.     float    targetFact;
  46.     float    minRadius;
  47.     float    centerFact;
  48.     float    momentum;
  49.     float    distComp;
  50.     char    *schoolString;
  51.     char    *oldString;
  52.     float    *coords;
  53.     float    *oldCoords;
  54.     NXPoint    goalPoint;
  55.     BOID    *theSchools;
  56.     NXColor    theBackColor;
  57.     id        theFont;
  58.     id        thePanel;
  59.     id        countField;
  60.     id        countSlider;
  61.     id        vMaxField;
  62.     id        vMaxSlider;
  63.     id        avoidField;
  64.     id        avoidSlider;
  65.     id        followSwitch;
  66.     id        targetImage;
  67. }
  68.  
  69. + initialize;
  70.  
  71. - initFrame:(const NXRect *)theFrame;
  72. - free;
  73. - setup;
  74. - oneStep;
  75. - setValues;
  76. - didLockFocus;
  77. - awakeFromNib;
  78. - writeDefaults;
  79. - inspector:sender;
  80. - takeValues:sender;
  81. - computeAccelerations;
  82. - (BOOL)useBufferedWindow;
  83. - (BOOL)ignoreMouseMovement;
  84. - sizeTo:(NXCoord)w :(NXCoord)h;
  85. - drawSelf:(const NXRect *)theRects :(int)rectCount;
  86. @end
  87.